package com.qqtech.qquan.hi.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.core.frame.service.BaseServiceImpl;

import com.qqtech.qquan.hi.dao.HiRuleDao;
import com.qqtech.qquan.hi.model.*;

@Service
public class HiRuleServiceImpl extends BaseServiceImpl<HiRule>
		implements HiRuleService {
	public static final Logger log = LoggerFactory.getLogger(HiRuleServiceImpl.class);
	
	@Resource
	private HiRuleDao hiRuleDao;

	@Override
	protected BaseDao<HiRule> getBaseDao() {
		return hiRuleDao;
	}

	@Override
	public boolean checkHaveRuleByClassify(Integer classify, Integer status) {
		HiRuleQuery q = new HiRuleQuery();
		q.setClassify(classify);
		q.setStatus(status);
		int count = hiRuleDao.queryCount(q);
		return count > 0;
	}

	@Override
	public List<HiRuleVo> queryRuleByClassify(Integer classify, Integer status) {
		HiRuleQuery q = new HiRuleQuery();
		q.setClassify(classify);
		q.setStatus(status);
		return hiRuleDao.queryList(q);
	}
	
}